#include "ifaceItemModel.h"

IfaceItemModel::IfaceItemModel(const QString &iface_name, const QString &iface_picture, QObject *parent) :
  ListItem(parent), m_iface_name(iface_name), m_iface_picture(iface_picture)
{
}

void IfaceItemModel::setIfaceName(QString &ifaceName)
{
  if(m_iface_name != ifaceName) {
    m_iface_name = ifaceName;
    emit dataChanged();
  }
}

void IfaceItemModel::setIfacePicture(QString &ifacePic)
{
  if(m_iface_picture != ifacePic) {
    m_iface_picture = ifacePic;
    emit dataChanged();
  }
}

QHash<int, QByteArray> IfaceItemModel::roleNames() const
{
  QHash<int, QByteArray> names;
  names[IfaceNameRole] = "ifaceName";
  names[IfacePictureRole] = "ifacePicture";
  return names;
}

QVariant IfaceItemModel::data(int role) const
{
  switch(role) {
  case IfaceNameRole:
    return ifaceName();
  case IfacePictureRole:
    return ifacePicture();
  default:
    return QVariant();
  }
}
